class Task28:
    def run(self, tree):
        if tree is None:
            return False

        stack1 = [tree]
        stack2 = [tree]

        while len(stack1) > 0:
            node1 = stack1.pop()
            node2 = stack2.pop()
            if node1 is None and node2 is None:
                continue
            elif node1 is None or node2 is None:
                return False
            elif node1.val is not node2.val:
                return False
            else:
                stack1.append(node1.left)
                stack1.append(node1.right)
                stack2.append(node2.right)
                stack2.append(node2.left)
        return True
